package com.omega.exam.config;

import com.omega.exam.common.KimiProperties;
import jakarta.annotation.Resource;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.client.WebClient;

@Configuration
@EnableConfigurationProperties(KimiProperties.class)
public class WebClientConfiguration {
    @Resource
    private KimiProperties kimiProperties;
    @Bean
    public WebClient webClient(){
        System.out.println(kimiProperties.getUri()+"kiu");
        WebClient webClient=WebClient.builder().baseUrl("https://api.moonshot.cn/v1/chat/completions")
                .defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
                .defaultHeader("Authorization", "Bearer " + "sk-ktrEL0vKdO7t3CuGaCe1cNXGfI39JpxFuxXLlKHKZ8XjdEV3")
                .build();
        return webClient;
    }

}
